<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<%@ page import="com.hzqy.web.vo.PmsUserVo"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>模板增加</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">
<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"	src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/lang/zh-cn/zh-cn.js"></script>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<%
PmsUserVo vo=((PmsUserVo)session.getAttribute("SESSION_USER"));
String userName="";
int f_cc_company_id=0;
int status=2;
if(vo!=null){
	userName=vo.getF_pu_name();
	f_cc_company_id=vo.getOrgId();
	if(vo.getRoleIds().equals("2")||vo.getRoleIds().equals("1")){//省公司
		status=16;
	}else if(vo.getRoleIds().equals("3")){//市公司
		status=2;
	}
}
String []nonceObj=ConstantUtils.getNonceObject();
%>
<script type="text/javascript">
/* $(function(){
		$.ajax({
			url:"../../pms/org_list.do",
			success:function(data) {
				data = JSON.parse(data);
				var str = "";
				for(var i=0;i<data.length;i++) {
					str+='<option value="'+data[i].id+'">'+data[i].name+'</option>';
				}
				$("#f_cc_companyid").append(str);
			}
		});
	});	 */
	$(function() {
		$("#contentForm").validate({
			rules: {
				f_cc_name: {
					required: true,
					maxlength: 50
				},
			/* 	f_cc_desc: {
					required: true
				}, */
				 f_cc_company_name:{
					required:true
				} 
				
			},
			messages: {
				f_cc_name: {
					required: "请输入模板名称",
					maxlength: "模板名称不能超过50位"
				},
			/* 	f_cc_desc: {
					required: "请输入路径"
				}, */
				 f_cc_company_name:{
					required:"请选择组织"
				} 
			}
			
		});
	});

	function _submitFm() {
		var definitionflag = 0;
		$('input[name="definitionflag"]').each(function(idx, ele){
			definitionflag += $(this).is(':checked')?parseInt($(this).val()):0;
		});
		$('#f_cc_definitionflag').val(definitionflag);
		arrayToJson();
		if($("#contentForm").validate().form()) {
			if($("#picJson").val()!=""&&$("#picJson").val()!="[]"){
				$("#f_cc_viewindex").val(1);
			}
		app_ajax('../../content/insert_content.do', $("#contentForm").serialize(), function(data) {
				if (data.success) {
					$.messager.progress('close');
					$.messager.alert('提示', '提交成功！', 'info', function() {
						parent.$('#dlg').dialog('close');
						parent.gotoSearch($('#easyui-treegrid'));
					});
				} else {
					$.messager.alert('提示', data.result, 'info', function() {
						$.messager.progress('close');
					});
				}
		});
	  }
	}
	
	function bind() {
		openDialog($('#org_list'),'../behavior_control/org_update.jsp?idField=f_cc_company_id&nameField=f_cc_company_name');
		//openDialog($('#dlg'),'org_bind.jsp?chooseid='+$("#f_cc_company_id").val());
	}
</script>
<style type="text/css">
</style>
</head>

<body class="overfwidth">
	<div class="barnavtop">您所在的位置：模板管理 &gt; 模板新增</div>
	<div id="workspace">
		<!--主体 开始-->
		<div id="container-1">
			<div class="editspace">
				<form id="contentForm" class="cmxform" enctype="multipart/form-data" name="formName">
					<input type="hidden" id="f_cast_id" name="f_cast_id" value=""/>
					<input id="f_cc_onlinedate" name="f_cc_onlinedate" type="hidden" value="2011-04-17 16:34:09" />
					<input id="f_cc_offlinedate" name="f_cc_offlinedate" type="hidden" value="2117-04-17 16:34:09" />
					<input id="f_cc_definitionflag" name="f_cc_definitionflag" type="hidden" value="0" />
					<input id="f_cc_seriescount" name="f_cc_seriescount" type="hidden" value="0" />
					<input id="f_cc_obligate3" name="f_cc_obligate3" type="hidden" value="0" />
					<input id="f_cc_obligate4" name="f_cc_obligate4" type="hidden" value="0" />
					<input id="f_cc_tags" name="f_cc_tags" type="hidden" value="" />
					<input id="f_cc_searchname" name="f_cc_searchname" type="hidden" value="" />
					<input id="f_cc_status" name="f_cc_status" type="hidden" value="<%=status %>" />
					<input id="f_cc_type" name="f_cc_type" type="hidden" value="20" />
					<input id="f_cc_director" name="f_cc_director" type="hidden" value="<%=userName %>" />
					<input id="f_cc_viewindex" name="f_cc_viewindex" type="hidden" value="0" />
					<input id="f_cc_programatype" name="f_cc_programatype" type="hidden" value="1" />
					<%-- <input name="f_cc_companyid" id="f_cc_company_id" type="hidden" value="<%=f_cc_company_id %>" />   --%>
					
					<legend style="text-align: center; margin: 0 auto;">模板新增</legend>
					<fieldset >
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>模板名称:
									</td>
									<td width="30%">
										<input id="f_cc_name" name="f_cc_name" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_name_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>组织选择:
									</td>
									<td width="30%">
										<input name="f_cc_company_name" id="f_cc_company_name" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
										<input name="f_cc_companyid" id="f_cc_company_id" type="hidden" value="" />  
										<input name="status" id="status" type="hidden" value="nochange" />  
										<span id="f_cc_companyid_tip" class="tip"></span>
										<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="bind();">选择</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset> 
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										路径:
									</td>
									<td width="30%">
										<input id="f_cc_desc" name="f_cc_desc" style="width: 150px;" readonly="readonly" value="" class="yl_inp yw_name" />
										<span id="f_cc_name_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										&nbsp;模板类型:
									</td>
									<td width="30%">
										<select id="f_cc_end" name="f_cc_end" style="width: 150px;">
											<option value="7" disabled="">广电酒店高清</option>
											<option value="8">中兴百视通公众</option>
											<option value="6" disabled="">广电酒店标清</option>
											<option value="5">百视通温台政企高清</option>
											<option value="13">广电公众高清</option>
											<option value="0" disabled="">百视通酒店标清</option>
											<option value="4">百视通政企高清</option>
											<option value="12">广电公众</option>
											<option value="3" disabled="">百视通温台酒店高清</option>
											<option value="11">中兴广电高清</option>
											<option value="2" disabled="">百视通酒店高清</option>
											<option value="10">中兴广电标清</option>
											<option value="1">百视通政企标清</option>
											<option value="9" disabled="">中兴百视通酒店</option>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					
					
					<fieldset class="hide-item">
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										是否通用:
									</td>
									<td width="30%">
										<select id="f_cc_isfree" name="f_cc_isfree" style="width: 150px;">
				                    		<option value="0">通用</option>
				                    		<option value="1">个性</option>
				                    	</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="40%" align="right">
										<jsp:include page="../../pictures/pictures_add_industry.jsp" flush="true">
											<jsp:param value="模板上传" name="picType"/>
											<jsp:param value="2" name="hierarchy"/>
										</jsp:include>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="40%" align="center">
									注：请使用winRAR程序打包zip上传，其他格式与压缩程序打包无法支持
									<a class="easyui-linkbutton" href="http://www.winrar.com.cn/"  target="view_frame">下载地址</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>

					
					<div class="toolbar" style="text-align: center;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
							href="javascript:void(0);" onclick="_submitFm()">保存</a> <a
							href="javascript:void(0);" data-options="iconCls:'icon-cancel'"
							class="easyui-linkbutton"
							onclick="javascript:parent.$('#dlg').dialog('close')">取消</a>
					</div>
				</form>
			</div>
		</div>
		<!--主体 结束-->
	</div>
	<div id="org_list" class="easyui-dialog"
		style="width: 600px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
</body>
</html>
